layui.use(['jquery','form','layer'], function(){
    var $ = layui.jquery
        ,form = layui.form
        ,layer = layui.layer;

        form.on('submit(commit-context)',function (data) {
            $.ajax({
                url:'../post-info/save',
                type:'POST',
                async:true,
                data: JSON.stringify(data.field),
                timeout:5000,    //超时时间
                dataType:'json',    //返回的数据格式：json/xml/html/script/jsonp/text
                contentType: "application/json",
                success:function(data){
                    if (data.code == '0'){
                        layer.msg("提交成功！",{icon:6},function (){
                           parent.location.reload();
                        });
                    }else {
                        layer.msg("系统异常，或获取用户信息失败。请重新登录！",{icon:6},function (){
                            location.href='member-login.html';
                        })
                    }
                }
            });

          return false;
        });
});